﻿cmake_minimum_required(VERSION 3.2.5)

string(TIMESTAMP PROJECT_COMPILE_TIME %y%m%d)

project(NebulaWeaver VERSION 1.1.0.${PROJECT_COMPILE_TIME} LANGUAGES C CXX)

set(ProjectName ${CMAKE_PROJECT_NAME})

#在执行编译时将会输出更详细的信息
set(CMAKE_VERBOSE_MAKEFILE ON)

#如果设置为True，则必须使用CMAKE_CXX_STANDARD指定的版本
#用ON、TRUE等都可以表示真，OFF、FALSE等都可以表示假
set(CMAKE_CXX_STANDARD 17)
#set(CMAKE_CXX_STANDARD_REQUIRED True)


if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
    MESSAGE("Clang")
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
    MESSAGE("GNU")
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
    MESSAGE("Intel")
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
    MESSAGE("MSVC")
endif()

if(CMAKE_CXX_COMPILER_LOADED)
    message(STATUS "The C++ compiler ID is: ${CMAKE_CXX_COMPILER_ID}")
    message(STATUS "Is the C++ from GNU? ${CMAKE_COMPILER_IS_GNUCXX}")
    message(STATUS "The C++ compiler version is: ${CMAKE_CXX_COMPILER_VERSION}")
endif()
message(STATUS "Is the C compiler loaded? ${CMAKE_C_COMPILER_LOADED}")
if(CMAKE_C_COMPILER_LOADED)
    message(STATUS "The C compiler ID is: ${CMAKE_C_COMPILER_ID}")
    message(STATUS "Is the C from GNU? ${CMAKE_COMPILER_IS_GNUCC}")
    message(STATUS "The C compiler version is: ${CMAKE_C_COMPILER_VERSION}")
endif()



#配置编译环境
include(${CMAKE_SOURCE_DIR}/cmake/nebula-weaver-env-include.cmake)

add_subdirectory(nebulaWeaver)

add_subdirectory(demo)

option(BUILD_TESTS "Build tests" ON)

message(STATUS "BUILD_TESTS: ${BUILD_TESTS}")
if(BUILD_TESTS)
    add_subdirectory(googletest)
    enable_testing()
endif(BUILD_TESTS)

add_subdirectory(tests)

#add_dependencies(tests nebulaWeaver)



